Skip to content

test(ui): Playwright coverage for CSV export jobs tray - #30883

Closed
anuj-kumary wants to merge 5 commits into
open-metadata:mainfrom
anuj-kumary:playwright-entity-export-jobs-tray
Closed

anuj-kumary wants to merge 5 commits into
open-metadata:mainfrom
anuj-kumary:playwright-entity-export-jobs-tray

Conversation

@anuj-kumary

@anuj-kumary anuj-kumary commented Aug 3, 2026 •

Copy link
Copy Markdown
Member

Describe your changes:

I added Playwright E2E coverage for the CSV export jobs tray, which previously only had Jest component coverage. This closes two gaps:

  1. Auto-open behaviour from Improve bulk export action stats #30615 — the tray now opens on its own when a background job reaches a terminal state. No Playwright test asserted this.
  2. Per-entity export → tray flow — the real Manage ▸ Export UI wiring was only tray-asserted for Metrics and dataAsset (Explore). The other export surfaces went through the API and deliberately suppressed the tray.

Type of change:

  • Improvement (test coverage)

High-level design:

CsvJobsTray.spec.ts (+4 tests): tray auto-opens on export completion, auto-opens on import failure, does not surface a job already terminal on initial load, and does not re-open a terminal job after the user minimizes it.

EntityExportJobsTray.spec.ts (new, 5 tests): drives the real Manage ▸ Export button for Database Service, Database, Database Schema, Table, and Glossary and asserts the job surfaces in the tray.

The tray is a global, user-scoped widget and every CI worker runs as the same admin, so a real export job would leak across parallel tests. These specs are therefore hermetic and fully independent in both directions:

  • exportAsync is stubbed to return a job object (still exercises the real button + runTrayExport refresh dispatch) so no real backend job is created → nothing leaks out to other workers.
  • csvAsyncJobs is mocked page-scoped so the tray shows only this test's synthetic job → nothing leaks in.

Both routes are page-scoped and cannot affect any other running test.

Tests:

Use cases covered

  • Export/import jobs tray auto-opens when a job completes or fails
  • A finished job from a previous session is not re-surfaced on load
  • Minimizing an auto-opened tray does not make it pop back open
  • Manage ▸ Export on Database Service / Database / Schema / Table / Glossary surfaces the job in the tray

Notes

  • Test-only change; no product code touched.
  • Verified locally: ESLint (eslint-plugin-playwright), Prettier, organize-imports, and tsc all clean; no forbidden Playwright patterns (.only, networkidle, page.pause, force:true).

🤖 Generated with Claude Code


Summary by Gitar

  • UI enhancements:
    • Revamped workflow details header page using HeaderShell and updated breadcrumb layout in WorkflowBuilder.

This will update automatically on new commits.

@anuj-kumary
anuj-kumary requested review from a team, chirag-madlani and karanh37 as code owners August 3, 2026 15:53
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

  • No GitHub issue is linked. Link an issue in the Development section of the PR (or add Fixes #12345 to the description). For a same-org cross-repo issue, add Fixes open-metadata/<repo>#123 to the description.

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions github-actions Bot added the UI UI specific issues label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@anuj-kumary
anuj-kumary force-pushed the playwright-entity-export-jobs-tray branch from 8e71ad1 to 4f180b1 Compare August 3, 2026 15:56
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@anuj-kumary anuj-kumary self-assigned this Aug 3, 2026
@anuj-kumary anuj-kumary added safe to test Add this label to run secure Github workflows on PRs skip-pr-checks Bypass PR metadata validation check To release Will cherry-pick this PR into the release branch labels Aug 3, 2026
@github-actions github-actions Bot removed the safe to test Add this label to run secure Github workflows on PRs label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@anuj-kumary anuj-kumary added the safe to test Add this label to run secure Github workflows on PRs label Aug 3, 2026
Rohit0301
Rohit0301 previously approved these changes Aug 3, 2026
@github-actions github-actions Bot removed the safe to test Add this label to run secure Github workflows on PRs label Aug 3, 2026
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@anuj-kumary anuj-kumary added the safe to test Add this label to run secure Github workflows on PRs label Aug 3, 2026
@github-actions github-actions Bot removed the safe to test Add this label to run secure Github workflows on PRs label Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

2 similar comments
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@anuj-kumary anuj-kumary added the safe to test Add this label to run secure Github workflows on PRs label Aug 7, 2026
siddhant1
siddhant1 previously approved these changes Aug 7, 2026
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@github-actions

github-actions Bot commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 66%
66.22% (78152/118018) 50.22% (47201/93982) 51.43% (14220/27645)

@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

anuj-kumary and others added 2 commits August 7, 2026 13:12
…tJobsTray spec

- impact-map.json: map CsvJobsTray/EntityExportModalProvider/csvAPI sources to
  both spec files so source-file PRs trigger the right Playwright coverage.
  Delegate EntityExportJobsTray.spec.ts so stale-baseline gate does not fire
  when only the spec itself changes.

- EntityExportJobsTray.spec.ts (new): hermetic E2E test for the Manage →
  Export → jobs-tray flow across Database Service, Database, Schema, Table
  and Glossary entities.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion tests

Remove all page.route() mocking per reviewer feedback. Tests now create genuine
export jobs via the Explore UI, poll /csvAsyncJobs with performAdminLogin for
auth, and run serially to prevent job-list contamination.

Add data-testid="csv-jobs-tray-item-{jobId}" to each tray item so assertions
can scope to the specific job each test created — parallel workers sharing the
admin user's job list cannot interfere with scoped selectors.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

…verrun

All 5 tests are new (no-mock rewrite changed every test name) so timing-
baseline.json has no history for them. Without delegation the planner falls
back to FALLBACK_TEST_MS and under-budgets the shard, reproducing the
chromium-12 SIGTERM from run 30716060441 (PR open-metadata#30812).

Same treatment as EntityExportJobsTray.spec.ts: delegated specs are excluded
from targeted PR plans but still run in full-mode nightly builds (where they
will seed real durations into the baseline) and via the source-file mapping
whenever CsvJobsTray, EntityExportModalProvider, or csvAPI changes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@sonarqubecloud

sonarqubecloud Bot commented Aug 7, 2026

Copy link
Copy Markdown

Drop stubExportAsync and mockCsvJobsPolling (both page.route() intercepts).
Tests now hit the real backend: the export response returns the real jobId,
and tray assertions are scoped to [data-testid="csv-jobs-tray-item-{jobId}"]
so parallel workers sharing the admin user cannot interfere.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

page.locator(`[data-testid="csv-jobs-tray-item-${jobId}"]`)
).toBeVisible({ timeout: 30_000 });

await expect(page.getByText(/Exporting/i).first()).toBeVisible();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Edge Case: 'Exporting' text assertion is flaky against real fast exports

This commit drops the mocked RUNNING job and drives real backend exports. The tray only renders 'Exporting…' while job.status !== 'COMPLETED'; a terminal job shows 'Exported…'. The test entities are tiny so the export almost always reaches COMPLETED before the first poll picks it up, at which point page.getByText(/Exporting/i) no longer matches ('Exported' does not contain 'Exporting') and the assertion fails. Assert on the job item presence (already scoped by csv-jobs-tray-item-${jobId}) and match either state, e.g. getByText(/Export(ing|ed)/i), or drop the transient-state text check entirely.

Was this helpful? React with 👍 / 👎

Comment on lines +107 to +108
const jobId = await triggerDataAssetExport(page);
await assertExportJobInTray(page, jobId);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Edge Case: Real export jobs now leak into the shared admin tray

Removing the exportAsync/csvAsyncJobs stubs means each test creates a real, persistent job under the shared admin user, and the deleted entity in finally does not remove the job from the user-scoped tray. Positive assertions are safely scoped by jobId, but the unscoped getByText(/Exporting/i).first() can match a concurrent worker's job, and accumulated jobs from prior/parallel tests remain in the tray. Consider scoping the state-text assertion within the csv-jobs-tray-item-${jobId} locator so it cannot pick up another worker's job.

Was this helpful? React with 👍 / 👎

@gitar-bot

gitar-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown
Code Review ⚠️ Changes requested 3 resolved / 5 findings

Adds Playwright E2E coverage for the CSV export jobs tray and various entity export flows. However, the changes introduce flaky assertions against fast exports and cause real export jobs to leak into the shared admin tray.

⚠️ Edge Case: 'Exporting' text assertion is flaky against real fast exports

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:87 📄 openmetadata-ui/src/main/resources/ui/src/components/common/EntityImport/CsvJobsTray/CsvJobsTray.component.tsx:266-268

This commit drops the mocked RUNNING job and drives real backend exports. The tray only renders 'Exporting…' while job.status !== 'COMPLETED'; a terminal job shows 'Exported…'. The test entities are tiny so the export almost always reaches COMPLETED before the first poll picks it up, at which point page.getByText(/Exporting/i) no longer matches ('Exported' does not contain 'Exporting') and the assertion fails. Assert on the job item presence (already scoped by csv-jobs-tray-item-${jobId}) and match either state, e.g. getByText(/Export(ing|ed)/i), or drop the transient-state text check entirely.

💡 Edge Case: Real export jobs now leak into the shared admin tray

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:107-108 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:42 📄 openmetadata-ui/src/main/resources/ui/src/components/common/EntityImport/CsvJobsTray/CsvJobsTray.component.tsx:87-88

Removing the exportAsync/csvAsyncJobs stubs means each test creates a real, persistent job under the shared admin user, and the deleted entity in finally does not remove the job from the user-scoped tray. Positive assertions are safely scoped by jobId, but the unscoped getByText(/Exporting/i).first() can match a concurrent worker's job, and accumulated jobs from prior/parallel tests remain in the tray. Consider scoping the state-text assertion within the csv-jobs-tray-item-${jobId} locator so it cannot pick up another worker's job.

✅ 3 resolved
✅ Bug: OMSelectWidget caches static options, ignores field change

📄 openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMSelectWidget.tsx:49-50 📄 openmetadata-ui/src/main/resources/ui/src/utils/queryBuilderWidgets/OMSelectWidget.tsx:112-125
In OMSelectWidget the static (non-async) branch initializes items via useState(staticItems) and only ever calls setItems from the async fetch path, so listValues derived options are snapshotted on mount. If RAQB reuses the same widget instance when the rule's field changes (the exact scenario OMMultiSelectWidget documents and guards against by deriving options from props each render), the static dropdown will keep showing the previous field's options. Derive the static options directly from props (e.g. const allItems = isAsync ? asyncItems : staticItems;) so a field switch reflects the new listValues, matching the multiselect widget's handling.

✅ Edge Case: csvAsyncJobs mock registered after page navigation leaves leak window

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:113-123 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:135-145 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:157-167 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:179-187 📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:199-209
In EntityExportJobsTray.spec.ts each test calls visitEntityPage(page) and only afterwards registers mockCsvJobsPolling. The PR's whole isolation guarantee is that the tray shows only this test's synthetic job, but the tray polls /api/v1/csvAsyncJobs during initial page load before the mock is installed. Because the tray is a global, user-scoped widget and all CI workers run as the same admin, a real RUNNING export created by another parallel spec could be picked up in that unmocked window and, if the tray accumulates rather than fully replaces its job list, break the toHaveCount(1) assertion. Register mockCsvJobsPolling (and stubExportAsync) before calling visitEntityPage to close the window.

✅ Edge Case: Real export jobs leak across the shared admin job tray

📄 openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/CsvJobsTray.spec.ts:73-87
The rewritten spec creates real backend export jobs under the shared admin user, and the CSV jobs tray is a global user-scoped widget. test.describe.serial only serializes within this file; other spec files run in parallel workers as the same admin, so jobs created here surface in their trays (and vice versa). The afterEach cleanup is best-effort and only reliably clears terminal jobs — the first test ('tray surfaces an export job after export starts') never waits for completion, so it can leave a RUNNING job that the 'clear completed' button won't remove, leaking into subsequent tests and other workers. This directly contradicts the PR summary's claim of page-scoped/hermetic mocking and is a likely source of cross-worker flakiness. Consider scoping this file to run non-parallel/isolated, or filter tray assertions to the specific jobId created by each test rather than .first().

🤖 Prompt for agents
Code Review: Adds Playwright E2E coverage for the CSV export jobs tray and various entity export flows. However, the changes introduce flaky assertions against fast exports and cause real export jobs to leak into the shared admin tray.

1. ⚠️ Edge Case: 'Exporting' text assertion is flaky against real fast exports
   Files: openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:87, openmetadata-ui/src/main/resources/ui/src/components/common/EntityImport/CsvJobsTray/CsvJobsTray.component.tsx:266-268

   This commit drops the mocked RUNNING job and drives real backend exports. The tray only renders 'Exporting…' while `job.status !== 'COMPLETED'`; a terminal job shows 'Exported…'. The test entities are tiny so the export almost always reaches COMPLETED before the first poll picks it up, at which point `page.getByText(/Exporting/i)` no longer matches ('Exported' does not contain 'Exporting') and the assertion fails. Assert on the job item presence (already scoped by `csv-jobs-tray-item-${jobId}`) and match either state, e.g. `getByText(/Export(ing|ed)/i)`, or drop the transient-state text check entirely.

2. 💡 Edge Case: Real export jobs now leak into the shared admin tray
   Files: openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:107-108, openmetadata-ui/src/main/resources/ui/playwright/e2e/Features/EntityExportJobsTray.spec.ts:42, openmetadata-ui/src/main/resources/ui/src/components/common/EntityImport/CsvJobsTray/CsvJobsTray.component.tsx:87-88

   Removing the `exportAsync`/`csvAsyncJobs` stubs means each test creates a real, persistent job under the shared admin user, and the deleted entity in `finally` does not remove the job from the user-scoped tray. Positive assertions are safely scoped by `jobId`, but the unscoped `getByText(/Exporting/i).first()` can match a concurrent worker's job, and accumulated jobs from prior/parallel tests remain in the tray. Consider scoping the state-text assertion within the `csv-jobs-tray-item-${jobId}` locator so it cannot pick up another worker's job.

Options

Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-pr-checks Bypass PR metadata validation check To release Will cherry-pick this PR into the release branch UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants